<%-- 管理员教师更新数据处理页面 --%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="java.sql.*"%>
<%@page import="org.edu.system.DBConnect"%>
<%@page import="org.edu.system.LogWriter" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<%
		String adm_id = (String) (session.getAttribute("UserName"));
		request.setCharacterEncoding("utf-8");
		String ids = request.getParameter("id");
		out.println(ids);
		String username = request.getParameter("username");
		String gender = request.getParameter("gender");
		String passwd = request.getParameter("passwd");
		String college = request.getParameter("college");
		String phone = request.getParameter("phone");
		String identity = request.getParameter("identity");
		String location = request.getParameter("location");
		String sql_select = "UPDATE teacher SET tc_name = '" + username + "',tc_passwd = '"
				+ passwd + "',tc_gender = '" + gender + "',tc_college = '" + college + "',tc_phone = '" + phone
				+ "',tc_identity = '" + identity + "',tc_location = '" + location + "' WHERE tc_id = '" + ids + "'";
		try {
			Connection con = DBConnect.getCon();
			System.out.println(sql_select);
			PreparedStatement pst = con.prepareStatement(sql_select);
			int rs = pst.executeUpdate();
			System.out.println(pst);
			System.out.println(rs);
			if (rs != 0) {
				LogWriter.LogPrint("["+request.getRemoteAddr()+"] "+adm_id+" 更新 "+ids+" 教师记录成功！");
				out.println("更新成功");
	%>
	<jsp:forward page="adm_teacher_info.jsp">
		<jsp:param name="ids" value="id" />
	</jsp:forward>
	<%
		}
		} catch (Exception e) {
			out.println(e);
		}
	%>
</body>
</html>